import java.io.BufferedReader;
import java.io.FileInputStream;

import java.io.IOException;

import java.io.InputStreamReader;

import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.URL;


public class Voiter {
	
	//Proxy instance, proxy ip = 123.0.0.1 with port 8080
	public void v(String pr) throws MalformedURLException{
		String prx[] = pr.split(":");
		System.out.println(prx[0]+" "+Integer.parseInt(prx[1]));
			Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(prx[0], Integer.parseInt(prx[1])));
			URL url = new URL();
			HttpURLConnection uc;
			try {
				uc = (HttpURLConnection)url.openConnection(proxy);
				uc.setConnectTimeout(10000);
				uc.setReadTimeout(10000);
				uc.connect();
				
			BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));

			String line="";
			while ((line = in.readLine()) != null){
			   line=line + "\n";
			   System.out.println(line);
			   
			}
			uc.disconnect();
			} catch (IOException e) {
				System.out.println("galiak");
				return;
			}
	}

public void getProxy() throws IOException{
	
	BufferedReader in=new BufferedReader(new InputStreamReader(new FileInputStream("list.lst")));
	String line=null;
	while((line=in.readLine())!=null){
	   v(line.replaceAll(" ", ""));
	}
	
	
}
}
